//
//  CustomNavController.m
//  testLLLL
//
//  Created by ads on 16/1/15.
//  Copyright © 2016年 ads. All rights reserved.
//

#import "CustomNavController.h"
@interface CustomNavController () <UIGestureRecognizerDelegate>

@end

@implementation CustomNavController

+(void)initialize{
    /**
     *  如果需要设置UINavigationBar 在此设置
     */
    NSMutableDictionary  * textAtts = [NSMutableDictionary dictionary];
    textAtts[NSForegroundColorAttributeName]= [UIColor whiteColor];//设置文字颜色
    textAtts[NSFontAttributeName] = [UIFont navControllerTitleFont];//设置文字大小
    UINavigationBar * nab = [UINavigationBar appearance];
    nab.barTintColor = [UIColor orangeNavControllerTintColor];
    nab.translucent = NO;
    [nab setTitleTextAttributes:textAtts];
    
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (self.viewControllers.count==1) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.interactivePopGestureRecognizer.delegate =(id)self;
//    id target = self.interactivePopGestureRecognizer.delegate;
    
    // 创建全屏滑动手势，调用系统自带滑动手势的target的action方法
//    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:@selector(handleNavigationTransition:)];
    
    // 设置手势代理，拦截手势触发
//    pan.delegate = self;
//    [self.view addGestureRecognizer:pan];
    
    // 禁止使用系统自带的滑动手势
//    self.interactivePopGestureRecognizer.enabled = NO;

}

- (void)customSetting {
    NSMutableDictionary  * textAtts = [NSMutableDictionary dictionary];
    textAtts[NSForegroundColorAttributeName]= [UIColor blackNavControllerTitleColor];//设置文字颜色
    textAtts[NSFontAttributeName] = [UIFont navControllerTitleFont];//设置文字大小
    self.navigationBar.translucent = NO;
    self.navigationBar.barTintColor = [UIColor whiteColor];
    [self.navigationBar setTitleTextAttributes:textAtts];
}

- (void)setBarTintColor:(UIColor *)barTintColor {
    self.navigationBar.barTintColor = barTintColor;
}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if (self.viewControllers.count == 1) {
        return NO;
    }
    return YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
